﻿using Adapters.Model;
using System;
using System.Collections.Generic;
using System.Data.Entity.Migrations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Adapters.Data
{
    public static class Seeder
    {
        public static void Seed(ApplicationDbContext db, bool todos = true)
        {
            if (todos) SeedTodos(db);
        }

        private static void SeedTodos(ApplicationDbContext db)
        {
            db.ToDos.AddOrUpdate(x => x.ToDoId,
                new ToDo() { ToDoId = 1, Description = "Learn Adapters", DateCreated = DateTime.Now },
                new ToDo() { ToDoId = 2, Description = "Learn Interfaces", DateCreated = DateTime.Now.AddDays(-1) },
                new ToDo() { ToDoId = 3, Description = "Learn Api", DateCreated = DateTime.Now.AddDays(-2) },
                new ToDo() { ToDoId = 4, Description = "Learn Authorization", DateCreated = DateTime.Now.AddDays(1) },
                new ToDo() { ToDoId = 5, Description = "Learn Authentication", DateCreated = DateTime.Now.AddDays(3) },
                new ToDo() { ToDoId = 6, Description = "Relearn Angular", DateCreated = DateTime.Now.AddDays(4) }
                );
        }
    }
}